package ca.athabascau.quizmaster.data;
import java.io.FileInputStream;
	import java.io.FileNotFoundException;
	import java.io.IOException;
	import java.util.InvalidPropertiesFormatException;
	import java.util.Properties;
	
	
public class Comp667ProjectSettings {
	
		private String databaseLocation;
		private String loadAllAnwersQuery;
		private String singleOntologyQuery;
		private String loadAllAnswersQueryFiltered;
		private String questionCountQuery;
	
		public Comp667ProjectSettings() {
			try {
				setProperties();
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (InvalidPropertiesFormatException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		private void setProperties() throws FileNotFoundException, IOException,
				InvalidPropertiesFormatException {
			Properties prop = new Properties();
			FileInputStream fis = new FileInputStream(
					"./ProjectSettings/Comp667ProjectProperties.xml");
			prop.loadFromXML(fis);
			setDatabaseLocation(prop.getProperty("databaseLocation","jdbc:hsqldb:file:./Data/QMDB"));
			setLoadAllAnwersQuery(prop.getProperty("loadAllAnswersQuery","Select * from Answer;"));
			setSingleOntologyQuery(prop.getProperty("singleOntologyQuery","Select * from Ontology;"));
			setLoadAllAnswersQueryFiltered(prop.getProperty("loadAllAnswersQueryFiltered",""));
			setQuestionCountQuery(prop.getProperty("questionCountQuery",""));
		}

		public String getDatabaseLocation() {
			return databaseLocation;
		}

		public void setDatabaseLocation(String databaseLocation) {
			this.databaseLocation = databaseLocation;
		}

		public String getLoadAllAnwersQuery() {
			return loadAllAnwersQuery;
		}

		public void setLoadAllAnwersQuery(String loadAllAnwersQuery) {
			this.loadAllAnwersQuery = loadAllAnwersQuery;
		}
		public String getSingleOntologyQuery() {
			return singleOntologyQuery;
		}
		public void setSingleOntologyQuery(String singleOntologyQuery) {
			this.singleOntologyQuery = singleOntologyQuery;
		}
		public String getLoadAllAnswersQueryFiltered() {
			return loadAllAnswersQueryFiltered;
		}
		public void setLoadAllAnswersQueryFiltered(
				String loadAllAnswersQueryFiltered) {
			this.loadAllAnswersQueryFiltered = loadAllAnswersQueryFiltered;
		}
		public String getQuestionCountQuery() {
			return questionCountQuery;
		}
		public void setQuestionCountQuery(String questionCountQuery) {
			this.questionCountQuery = questionCountQuery;
		}

	}
